//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __MOUSE_H__
#define __MOUSE_H__

#include <driver.h>
#include "eventqueue.h"

/*
struct Calibration
{
public:
    ECode Calibrate();

private:
    Boolean m_bWorking;
    PVoid   m_hEvent;
};
*/

class CMouse: public CDeviceDriver
{
public:
    CARAPI Read(
        /* [in] */  Int64 offset,
        /* [in] */  Int32 numberOfBytesToRead,
        /* [out] */ MemoryBuf * pData,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */  Int64 offset,
        /* [in] */ const  MemoryBuf & ebbData,
        /* [out] */ Int32 * pNumberOfBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */  Handle32 controlCode,
        /* [in] */ const  MemoryBuf & ebbInData,
        /* [out] */ MemoryBuf * pOutData,
        /* [out] */ IEvent * * ppCompletionEvent);

    void Dispose();

public:
    STATIC ECode S_Create(
        /* [in] */ Int32 environmentId,
        /* [out] */ IDeviceDriver ** ppMouse);

    STATIC CMouse * S_Get(
        /* [in] */ Int32 environmentId);

public:
    CEventQueue * GetQueue() { return m_pEventQueue; }

private:
    ECode Calibrate();

    CMouse(Int32 environmentId)
         : m_environmentId(environmentId) {}
    ECode Initialize();

public:
    virtual ~CMouse();

private:
    Int32         m_environmentId;
    CEventQueue * m_pEventQueue;

    /* calibration settings */
    //Boolean m_bEnableCalibration;
    //Boolean m_bDuringCalibration;
    //PVoid   m_hCalibrationEvent;
};

typedef struct _MouseParams
{
    CMouse * pMouse;
    PVoid    pTouchData;
    PVoid    pSDLEvent;
}MouseParams;

#endif //__MOUSE_H__

